<hr>
<div class="row">
  <form role="form" accept-charset="UTF-8" action="/admin/flowhistories" method="GET">
    <div class="col-lg-3">
      <div class="form-group">
        <label>用户</label>
        {{ selectTag customerOptions customerCollection query.customerId }}
      </div>
    </div>
    <div class="col-lg-3">
      <div class="form-group">
        <label>状态</label>
        {{ selectTag stateOptions stateCollection query.state }}
      </div>
    </div>
    <div class="col-lg-3">
      <div class="form-group">
        <label>类型</label>
        {{ selectTag typeOptions typeCollection query.type }}
      </div>
    </div>
    <div class="col-lg-3" style="padding-top: 19px;">
      <div class="form-group">
        <button type='submit' class="btn btn-info col-lg-8 pull-right">搜索</button>
      </div>
    </div>
  </form>
</div>
<hr>
<div class="row">
  <div class="col-lg-12">
    <div class="panel panel-default">
      <div class="panel-heading">
          流量历史
      </div>
      <!-- /.panel-heading -->
      <div class="panel-body">
        <div class="table-responsive">
          <table class="table table-striped">
            <thead>
              <tr>
                <th></th>
                <th>用户</th>
                <th>状态</th>
                <th>数目</th>
                <th>内容</th>
                <th>创建时间</th>
              </tr>
            </thead>
            <tbody>
              {{#each flowhistories.rows}}
                <tr>
                    <td>{{ customerId }}</td>
                    <td><img src="{{customer.headimgurl}}" onError="this.src='http://placehold.it/380x380';" style="width: 36px;">{{ customer.username }}</td>
                    <td>{{ flowhistorySourceLink source }}</td>
                    <td>{{ amountType state amount }}</td>
                    <td>{{ comment }}</td>
                    <td>
                      {{ strftime createdAt }}
                    </td>
                    {{#is_admin ../user }}
                      <td>
                        <a href="/admin/flowhistories/{{id}}/delete" class="list-group-item" onclick="return confirm('你确定需要删除这条记录吗？')">
                          <i class="glyphicon glyphicon-trash"></i>
                        </a>
                      </td>
                    {{/is_admin}}
                </tr>
              {{/each}}
            </tbody>
          </table>
        </div>
        <!-- /.table-responsive -->
      </div>

      <div class="panel-footer">
          {{pagination flowhistories (addParams '/admin/flowhistories' query)}}
      </div>
      <!-- /.panel-body -->
    </div>
    <!-- /.panel -->
  </div>
</div>